package com.dabao.service.impl;

import com.dabao.bean.User;
import com.dabao.query.UserQuery;
import com.dabao.service.UserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by dabao on 16/3/4.
 */
@Service
public class UserServiceImpl extends BaseServiceImpl<User, UserQuery> implements UserService{

    public User findByUsername(String username) {
        UserQuery userQuery = new UserQuery();
        userQuery.setUsername(username);
        List<User> users = dao.selectList(userQuery);
        if(users.size() > 0) {
            return users.get(0);
        }
        return null;
    }
}
